{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "\n",
    "\n",
    "url = \"https://www.taobao.com\"\n",
    "cookie_str = 'cookie2=9e119bf60fe9553b28c554a50e123956;_tb_token_=FhB4kUPnudq;t=326997d3c72d1924c5826a9987ad2f71;v=0;cookie32=9cf7c3c21fc40b519af8937f59020485;cookie31=MTIyMzI2OTk2LCVFOCU4QiVBNiVFNSU5MyU4ODIwMDksNTc2ODc5ODE0QHFxLmNvbSxUQg%3D%3D;alimamapwag=TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV09XNjQ7IHJ2OjUzLjApIEdlY2tvLzIwMTAwMTAxIEZpcmVmb3gvNTMuMA%3D%3D;login=UIHiLt3xD8xYTw%3D%3D;alimamapw=RHslRiBUHSdYFHMjBVVVXzoAVF1XVQRTD1UDBAJfBQYDVlADVgpQAVRTCQNVAFEDVQ%3D%3D;cna=hDKkEa034AYCAXUePDLY4eN2'\n",
    "headers = {'Cookie': cookie_str}\n",
    "r = requests.get(url, headers=headers)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'cookie2=9e119bf60fe9553b28c554a50e123956;_tb_token_=FhB4kUPnudq;t=326997d3c72d1924c5826a9987ad2f71;v=0;cookie32=9cf7c3c21fc40b519af8937f59020485;cookie31=MTIyMzI2OTk2LCVFOCU4QiVBNiVFNSU5MyU4ODIwMDksNTc2ODc5ODE0QHFxLmNvbSxUQg%3D%3D;alimamapwag=TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV09XNjQ7IHJ2OjUzLjApIEdlY2tvLzIwMTAwMTAxIEZpcmVmb3gvNTMuMA%3D%3D;login=UIHiLt3xD8xYTw%3D%3D;alimamapw=RHslRiBUHSdYFHMjBVVVXzoAVF1XVQRTD1UDBAJfBQYDVlADVgpQAVRTCQNVAFEDVQ%3D%3D;cna=hDKkEa034AYCAXUePDLY4eN2'"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "l = [{\"domain\": \".alimama.com\", \"secure\": \"false\", \"value\": \"9e119bf60fe9553b28c554a50e123956\", \"expiry\": \"null\", \"path\": \"/\", \"httpOnly\": \"true\", \"name\": \"cookie2\"}, {\"domain\": \".alimama.com\", \"secure\": \"false\", \"value\": \"FhB4kUPnudq\", \"expiry\": \"null\", \"path\": \"/\", \"httpOnly\": \"false\", \"name\": \"_tb_token_\"}, {\"domain\": \".alimama.com\", \"secure\": \"false\", \"value\": \"326997d3c72d1924c5826a9987ad2f71\", \"expiry\": \"null\", \"path\": \"/\", \"httpOnly\": \"false\", \"name\": \"t\"}, {\"domain\": \".alimama.com\", \"secure\": \"false\", \"value\": \"0\", \"expiry\": \"null\", \"path\": \"/\", \"httpOnly\": \"false\", \"name\": \"v\"}, {\"domain\": \".alimama.com\", \"secure\": \"false\", \"value\": \"9cf7c3c21fc40b519af8937f59020485\", \"expiry\": \"null\", \"path\": \"/\", \"httpOnly\": \"false\", \"name\": \"cookie32\"}, {\"domain\": \".alimama.com\", \"secure\": \"false\", \"value\": \"MTIyMzI2OTk2LCVFOCU4QiVBNiVFNSU5MyU4ODIwMDksNTc2ODc5ODE0QHFxLmNvbSxUQg%3D%3D\", \"expiry\": \"null\", \"path\": \"/\", \"httpOnly\": \"false\", \"name\": \"cookie31\"}, {\"domain\": \".alimama.com\", \"secure\": \"false\", \"value\": \"TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV09XNjQ7IHJ2OjUzLjApIEdlY2tvLzIwMTAwMTAxIEZpcmVmb3gvNTMuMA%3D%3D\", \"expiry\": \"null\", \"path\": \"/\", \"httpOnly\": \"true\", \"name\": \"alimamapwag\"}, {\"domain\": \".alimama.com\", \"secure\": \"false\", \"value\": \"UIHiLt3xD8xYTw%3D%3D\", \"expiry\": \"null\", \"path\": \"/\", \"httpOnly\": \"false\", \"name\": \"login\"}, {\"domain\": \".alimama.com\", \"secure\": \"false\", \"value\": \"RHslRiBUHSdYFHMjBVVVXzoAVF1XVQRTD1UDBAJfBQYDVlADVgpQAVRTCQNVAFEDVQ%3D%3D\", \"expiry\": \"null\", \"path\": \"/\", \"httpOnly\": \"true\", \"name\": \"alimamapw\"}, {\"domain\": \".alimama.com\", \"secure\": \"false\", \"value\": \"hDKkEa034AYCAXUePDLY4eN2\", \"expiry\": \"null\", \"path\": \"/\", \"httpOnly\": \"false\", \"name\": \"cna\"}]\n",
    "\n",
    "cookies_str = ';'.join([\"%s=%s\" % (cookie['name'], cookie['value']) for cookie in l])\n",
    "cookies_str\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
